package com.ktjy.service.impl;

import com.ktjy.mapper.SupplierMapper;
import com.ktjy.pojo.Supplier;
import com.ktjy.service.SupplierServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class SupplierServletImpl implements SupplierServlet {
    @Autowired
    SupplierMapper supplierMapper;

    @Override
    public List<Supplier> selectList() {
        return supplierMapper.selectList();
    }

    @Override
    public List<Supplier> selectPageList(String supCode, String supName, Integer pageNO, Integer pageSeiz) {
        List<Supplier> list = supplierMapper.selectPageList(supCode, supName, (pageNO - 1) * pageSeiz, pageSeiz);
        return list;
    }

    @Override
    public int count(String supCode, String supName) {
        int count = supplierMapper.count(supCode, supName);
        return count;
    }

    @Override
    public Supplier selectById(Integer id) {
        Supplier supplier = supplierMapper.selectById(id);
        return supplier;
    }

    @Override
    public int insert(Supplier supplier) {
        int insert = supplierMapper.insert(supplier);
        return insert;
    }

    @Override
    public int update(Supplier supplier) {
        int update = supplierMapper.update(supplier);
        return update;
    }

    @Override
    public int delete(Integer id) {
        int delete = supplierMapper.delete(id);
        return delete;
    }
}
